<template>
  <div class="info">
    <div v-for="(item, index) in list"
          :key="index" 
          :class="['item', index != 0 ? 'left-border' : '']"
          @click="click(item.my)">
        <div>
          <span class="num">{{item.num || my[index]}}</span>{{item.unit}}
        </div>
        <div>{{item.my}}</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Info',
    props: {
      list: {
        type: Array,
        default() {
          return []
        }
      }
    },
    computed: {
      my() {
        return this.$store.state.my
      }
    },
    methods: {
      click(info) {
        this.$toast.show(info, 2000)
      }
    }
  }
</script>

<style scoped>
.info {
  display: flex;
  align-items: center;
}
.item {
  flex: 1;
  text-align: center;
  padding: 15px 0;
}
.left-border {
  border-left: 2px solid #eee;
}
.num {
  font-size: 20px;
  color: #ff5f3e;
}
</style>